﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using QLHocSinh.DTO;
using QLHocSinh.DAO;
using QLHocSinh.BUS;

namespace QLHocSinh.BUS
{
    public enum LopHocBUSResult
    {
        OK,
        TENLOPERROR,
        SISOERROR,
        MAKHOIERROR,
        DAOERROR
    }

    public class LopHocBUS
    {
        public static DataTable LayDanhSachLopHoc()
        {
            return LopHocDAO.SelectAll();
        }
        public static LopHocBUSResult ThemLopHoc(LopHocDTO lh)
        {
            if (!LopHocDAO.InsertProc(lh))
                return LopHocBUSResult.DAOERROR;
            return LopHocBUSResult.OK;
        }
        public static LopHocBUSResult SuaLopHoc(LopHocDTO lh)
        {
            if (!LopHocDAO.UpdateProc(lh))
                return LopHocBUSResult.DAOERROR;
            return LopHocBUSResult.OK;
        }

        public static LopHocBUSResult XoaLopHoc(LopHocDTO lh)
        {
            if (!LopHocDAO.DeleteProc(lh))
                return LopHocBUSResult.DAOERROR;
            return LopHocBUSResult.OK;
        }
    }
}
